/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/***/ ((module) => {

module.exports = require("@nestjs/core");

/***/ }),
/* 2 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.MsgHandleModule = void 0;
const common_1 = __webpack_require__(3);
const msg_handle_service_1 = __webpack_require__(4);
const typeorm_1 = __webpack_require__(27);
const configure_1 = __webpack_require__(17);
const user_repository_module_1 = __webpack_require__(44);
const device_repository_module_1 = __webpack_require__(45);
const alicloud_1 = __webpack_require__(5);
const cache_1 = __webpack_require__(12);
const water_test_repository_module_1 = __webpack_require__(46);
const clean_record_repository_module_1 = __webpack_require__(47);
const water_bills_repository_module_1 = __webpack_require__(48);
const user_wallet_log_repository_module_1 = __webpack_require__(49);
let MsgHandleModule = class MsgHandleModule {
};
exports.MsgHandleModule = MsgHandleModule;
exports.MsgHandleModule = MsgHandleModule = __decorate([
    (0, common_1.Module)({
        imports: [
            configure_1.ConfigureModule.forRoot(),
            cache_1.CacheModule,
            typeorm_1.TypeOrmModule.forRootAsync({
                imports: [configure_1.ConfigureModule],
                inject: [configure_1.ConfigureService],
                useFactory: (config) => {
                    console.log(config.get('db'));
                    return {
                        ...config.get('db'),
                    };
                }
            }),
            alicloud_1.AlicloudModule.forRootAsync({
                imports: [configure_1.ConfigureModule],
                inject: [configure_1.ConfigureService],
                useFactory: (config) => {
                    return {
                        ...config.get('alicloud')
                    };
                },
            }),
            device_repository_module_1.DeviceRepositoryModule,
            user_repository_module_1.UserRepositoryModule,
            water_test_repository_module_1.WaterTestRepositoryModule,
            clean_record_repository_module_1.CleanRecordRepositoryModule,
            water_bills_repository_module_1.WaterBillsRepositoryModule,
            user_wallet_log_repository_module_1.UserWalletLogRepositoryModule,
        ],
        providers: [msg_handle_service_1.MsgHandleService],
    })
], MsgHandleModule);


/***/ }),
/* 3 */
/***/ ((module) => {

module.exports = require("@nestjs/common");

/***/ }),
/* 4 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.MsgHandleService = void 0;
const alicloud_1 = __webpack_require__(5);
const cache_1 = __webpack_require__(12);
const configure_1 = __webpack_require__(17);
const clean_record_repository_service_1 = __webpack_require__(26);
const device_repository_service_1 = __webpack_require__(31);
const User_1 = __webpack_require__(33);
const UserWalletLog_1 = __webpack_require__(34);
const WaterBills_1 = __webpack_require__(35);
const user_repository_service_1 = __webpack_require__(36);
const water_test_repository_service_1 = __webpack_require__(37);
const common_1 = __webpack_require__(3);
const DEVICE_CTR_ORDER_1 = __webpack_require__(39);
const DEVICE_CTR_RESULT_1 = __webpack_require__(40);
const TEST_STATUS_1 = __webpack_require__(41);
const WALLET_LOG_TYPE_1 = __webpack_require__(42);
const typeorm_1 = __webpack_require__(28);
const Device_1 = __webpack_require__(32);
const water_bills_repository_service_1 = __webpack_require__(43);
let MsgHandleService = class MsgHandleService {
    constructor(device, waterBills, user, alicloud, config, dataSource, cache, waterTest, cleanRecord) {
        this.device = device;
        this.waterBills = waterBills;
        this.user = user;
        this.alicloud = alicloud;
        this.config = config;
        this.dataSource = dataSource;
        this.cache = cache;
        this.waterTest = waterTest;
        this.cleanRecord = cleanRecord;
        this.aliToDeviceTopicReg = this.config.get('ALI_TO_DEVICE_TOPIC_REG');
        this.DEVICE_MSG_OF_REPORT_KEY = this.config.get('DEVICE_MSG_OF_REPORT_KEY');
    }
    onModuleInit() {
        this.readMsg();
    }
    async readMsg() {
        const size = 10;
        while (true) {
            const msgs = await this.cache.client.rpop(this.DEVICE_MSG_OF_REPORT_KEY, size);
            if (msgs == null) {
                break;
            }
            else {
                console.log('收到数据');
                console.log(msgs);
                msgs.forEach(msg => {
                    if (msg) {
                        try {
                            const message = JSON.parse(msg);
                            const date = new Date();
                            console.log(date.toLocaleDateString() + ' ' + date.toLocaleTimeString());
                            console.log(msg);
                            this.handle(message.time, message.topic, JSON.parse(message.data));
                        }
                        catch (error) {
                            console.log(error.message);
                        }
                    }
                });
                if (msgs.length < size) {
                    break;
                }
            }
        }
        setTimeout(() => {
            this.readMsg();
        }, 5000);
    }
    async handle(reportTime, topic, msgData) {
        console.log('------ handle ------');
        console.log(JSON.stringify(msgData));
        const deviceId = Number(msgData.dCore);
        let updateData = {
            connectStatus: 1
        };
        if (msgData.extend != undefined) {
            if (msgData.extend.SV != undefined) {
                updateData.software = msgData.extend.SV;
            }
        }
        this.device.update({ id: deviceId }, updateData);
        if (msgData.v == 'sd_1') {
            const key = msgData.cmd + ':' + msgData.dCore;
            if (msgData.err == undefined) {
                this.cache.set(key, DEVICE_CTR_RESULT_1.DEVICE_CTR_RESULT.SUCCESS, 10);
                if (msgData.cmd == DEVICE_CTR_ORDER_1.DEVICE_CTR_ORDER.SET_CLEAN_DEVICE) {
                    this.cleanRecord.update({ id: Number(msgData.msgId) }, { status: DEVICE_CTR_RESULT_1.DEVICE_CTR_RESULT.SUCCESS });
                }
            }
            else {
                this.cache.set(key, DEVICE_CTR_RESULT_1.DEVICE_CTR_RESULT.FAIL, 10);
                if (msgData.cmd == DEVICE_CTR_ORDER_1.DEVICE_CTR_ORDER.SET_CLEAN_DEVICE) {
                    this.cleanRecord.update({ id: Number(msgData.msgId) }, { status: DEVICE_CTR_RESULT_1.DEVICE_CTR_RESULT.FAIL, err: msgData.err });
                }
            }
            return;
        }
        if (msgData.v == 'dd_1') {
            let topics = topic.split("/");
            const productKey = topics[1];
            topics = null;
            if (msgData.r == 1) {
                const time = Math.floor(Date.now() / 1000);
                this.pub(deviceId, productKey, {
                    v: 'rs_1',
                    t_req: msgData.t_req || time,
                    t_resp: time
                });
            }
            if (msgData.sData && msgData.sData.length > 0) {
                msgData.sData.forEach(async (item) => {
                    console.log('-----------');
                    console.log(item.val);
                    if (item.val.eLuxData != undefined || item.val.eSensorStatus != undefined) {
                        console.log('is test');
                        console.log(item.val);
                        this.test(item.val, deviceId, reportTime);
                        return;
                    }
                    if (item.val.eFlow != undefined) {
                        this.waterFlow(item.val, deviceId, productKey, reportTime).then(r => {
                            console.log('结果');
                            console.log(r);
                        });
                    }
                });
            }
        }
    }
    async test(msg, deviceId, reportTime) {
        const key = 'test.' + deviceId;
        console.log('------ 检测 --------------');
        console.log(msg);
        if (msg.eSensorStatus == undefined) {
            const id = await this.cache.get(key);
            if (id == null) {
                return;
            }
            const row = await this.waterTest.findOne({ id: Number(id) }, { id: true, status: true });
            if (row.status == TEST_STATUS_1.TEST_STATUS.testing) {
                this.waterTest.update({ id: row.id }, {
                    result: msg.eLuxData
                });
            }
        }
        else {
            const id = await this.cache.get(key);
            if (id == null) {
                console.log('没有检测');
                if (msg.eSensorStatus == 1) {
                    this.waterTest.update({ deviceId: deviceId, status: TEST_STATUS_1.TEST_STATUS.testing }, { status: TEST_STATUS_1.TEST_STATUS.stop });
                    this.startNewTest(deviceId);
                }
                return;
            }
            const field = {
                id: true, status: true
            };
            const row = await this.waterTest.findOne({ id: Number(id) }, field);
            if (msg.eSensorStatus == 0) {
                if (row.status == TEST_STATUS_1.TEST_STATUS.start) {
                    this.waterTest.update({ id: row.id }, { status: TEST_STATUS_1.TEST_STATUS.fail, endTime: reportTime });
                }
                else if (row.status == TEST_STATUS_1.TEST_STATUS.testing) {
                    this.waterTest.update({ id: row.id }, { status: TEST_STATUS_1.TEST_STATUS.stop, endTime: reportTime });
                }
                this.cache.del(key);
            }
            else if (msg.eSensorStatus == 1) {
                if (row.status == TEST_STATUS_1.TEST_STATUS.testing) {
                    this.waterTest.update({ id: row.id }, { status: TEST_STATUS_1.TEST_STATUS.stop });
                }
                this.startNewTest(deviceId);
            }
            else if (msg.eSensorStatus == 2) {
                this.cache.del(key);
                this.waterTest.update({ id: row.id }, { status: TEST_STATUS_1.TEST_STATUS.end, endTime: reportTime });
            }
        }
    }
    async startNewTest(deviceId) {
        const device = await this.device.findOne({ id: deviceId }, { id: true, userId: true });
        const r = await this.waterTest.insert({
            userId: device.userId,
            deviceId,
            createTime: Math.floor(Date.now() / 1000),
            status: TEST_STATUS_1.TEST_STATUS.testing
        });
        this.cache.set('test.' + deviceId, r.rows[0][this.waterTest.primaryKey], 60 * 60);
    }
    async waterFlow(msg, deviceId, productKey, reportTime) {
        console.log('-------- waterFlow ---------');
        console.log(msg);
        const device = await this.device.findOne({ id: deviceId }, { userId: true, id: true, totalWaterUsage: true });
        if (!device)
            return;
        const reply = {
            "v": "ss_1",
            "cmd": "setMaxWaterFlow",
            "goal": "1-1",
            "port": "1-1",
            "param": "0",
            "childPort": ""
        };
        console.log(msg.eFlow > 0);
        if (msg.eFlow > 0) {
            let amount = Number((0.01 * msg.eFlow).toFixed(2));
            let bills = {
                reportTime: reportTime,
                userId: device.userId,
                deviceId: deviceId,
                amount: String(amount),
                waterUsage: msg.eFlow,
                tdsRaw: msg.eTDS_Raw,
                tdsClean: msg.eTDS_Clean,
                createTime: Math.floor(Date.now() / 1000)
            };
            if (device.userId > 0) {
                const queryRunner = await this.dataSource.createQueryRunner();
                await queryRunner.connect();
                await queryRunner.startTransaction();
                try {
                    let user = await queryRunner.manager.findOne(User_1.User, {
                        where: { id: device.userId },
                        select: { amount: true, rewardAmount: true },
                        lock: {
                            mode: 'pessimistic_read'
                        }
                    });
                    console.log(user);
                    let orderId = 0;
                    let rechargeBalance = Number(user.amount);
                    let rewardBalance = Number(user.rewardAmount);
                    if ((rechargeBalance + rewardBalance) < amount) {
                        await queryRunner.rollbackTransaction();
                        return -1;
                    }
                    let { walletLog, walletUpdate } = this.walletUpdate(amount, rechargeBalance, rewardBalance, bills, user);
                    walletLog.type = WALLET_LOG_TYPE_1.WALLET_LOG_TYPE.WATER_PAY;
                    console.log('更新钱包');
                    const r1 = await queryRunner.manager.update(User_1.User, { id: device.userId }, walletUpdate);
                    if (r1.affected < 1) {
                        await queryRunner.rollbackTransaction();
                        return -2;
                    }
                    console.log('更新钱包11');
                    const r2 = await queryRunner.manager.insert(WaterBills_1.WaterBills, bills);
                    console.log('WaterBills1111');
                    if (!r2.raw || r2.raw.affectedRows < 1) {
                        await queryRunner.rollbackTransaction();
                        return -3;
                    }
                    walletLog.relationId = orderId = r2.raw.insertId;
                    walletLog.createTime = bills.createTime;
                    const r3 = await queryRunner.manager.insert(UserWalletLog_1.UserWalletLog, walletLog);
                    if (!r3.raw || r3.raw.affectedRows < 1) {
                        await queryRunner.rollbackTransaction();
                        return -4;
                    }
                    const r5 = await queryRunner.manager.update(Device_1.Device, { id: deviceId }, {
                        totalWaterUsage: device.totalWaterUsage + msg.eFlow
                    });
                    if (r5.affected < 1) {
                        await queryRunner.rollbackTransaction();
                        return -2;
                    }
                    await queryRunner.commitTransaction();
                    reply.param = (((user.amount + user.rewardAmount) / 0.01) * 1000).toFixed(2);
                    this.pub(deviceId, productKey, reply);
                    return orderId;
                }
                catch (error) {
                    console.log(error);
                    await queryRunner.rollbackTransaction();
                    return null;
                }
                finally {
                    await queryRunner.release();
                }
            }
            else {
                this.waterBills.insert(bills);
            }
        }
        else {
            if (device.userId > 0) {
                const user = await this.user.findOne({ id: device.userId }, { amount: true, rewardAmount: true });
                reply.param = Math.floor(((Number(user.amount) + Number(user.rewardAmount)) / 0.01) * 1000).toString();
            }
            else {
                reply.param = '1000';
            }
        }
        this.pub(deviceId, productKey, reply);
    }
    walletUpdate(amount, rechargeBalance, rewardBalance, order, wallet) {
        let walletUpdate = {};
        let walletLog = {
            userId: order.userId,
            beforeAmount: String(wallet.amount),
            beforeRewardAmount: String(wallet.rewardAmount)
        };
        if (rechargeBalance >= amount) {
            walletUpdate.amount = (rechargeBalance - amount);
            walletLog.amount = String(-amount);
            walletLog.afterAmount = String(walletUpdate.amount);
            walletLog.afterRewardAmount = String(wallet.rewardAmount);
        }
        else {
            let offset = amount - rechargeBalance;
            walletUpdate.rewardAmount = (rewardBalance - offset);
            walletLog.rewardAmount = String(-offset);
            walletLog.afterRewardAmount = String(walletUpdate.rewardAmount);
            if (rechargeBalance > 0) {
                walletUpdate.amount = 0;
                walletLog.amount = String(-rechargeBalance);
                walletLog.afterAmount = String(walletUpdate.amount);
            }
        }
        return {
            walletLog,
            walletUpdate
        };
    }
    async pub(deviceId, productKey, msg) {
        const deviceName = String(deviceId);
        msg.dCore = deviceName;
        this.alicloud.pub(productKey, this.aliToDeviceTopicReg.replace(/\?/, productKey).replace(/\?/, deviceName), deviceName, msg);
    }
};
exports.MsgHandleService = MsgHandleService;
exports.MsgHandleService = MsgHandleService = __decorate([
    (0, common_1.Injectable)(),
    __metadata("design:paramtypes", [typeof (_a = typeof device_repository_service_1.DeviceRepositoryService !== "undefined" && device_repository_service_1.DeviceRepositoryService) === "function" ? _a : Object, typeof (_b = typeof water_bills_repository_service_1.WaterBillsRepositoryService !== "undefined" && water_bills_repository_service_1.WaterBillsRepositoryService) === "function" ? _b : Object, typeof (_c = typeof user_repository_service_1.UserRepositoryService !== "undefined" && user_repository_service_1.UserRepositoryService) === "function" ? _c : Object, typeof (_d = typeof alicloud_1.AlicloudService !== "undefined" && alicloud_1.AlicloudService) === "function" ? _d : Object, typeof (_e = typeof configure_1.ConfigureService !== "undefined" && configure_1.ConfigureService) === "function" ? _e : Object, typeof (_f = typeof typeorm_1.DataSource !== "undefined" && typeorm_1.DataSource) === "function" ? _f : Object, typeof (_g = typeof cache_1.CacheService !== "undefined" && cache_1.CacheService) === "function" ? _g : Object, typeof (_h = typeof water_test_repository_service_1.WaterTestRepositoryService !== "undefined" && water_test_repository_service_1.WaterTestRepositoryService) === "function" ? _h : Object, typeof (_j = typeof clean_record_repository_service_1.CleanRecordRepositoryService !== "undefined" && clean_record_repository_service_1.CleanRecordRepositoryService) === "function" ? _j : Object])
], MsgHandleService);


/***/ }),
/* 5 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
__exportStar(__webpack_require__(6), exports);
__exportStar(__webpack_require__(7), exports);


/***/ }),
/* 6 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var AlicloudModule_1;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AlicloudModule = void 0;
const common_1 = __webpack_require__(3);
const alicloud_service_1 = __webpack_require__(7);
let AlicloudModule = AlicloudModule_1 = class AlicloudModule {
    static forRootAsync(options) {
        const providers = [
            {
                provide: 'ALI_MODULE_OPTIONS',
                useFactory: options.useFactory,
                inject: options.inject || [],
            },
            alicloud_service_1.AlicloudService,
        ];
        return {
            module: AlicloudModule_1,
            providers: providers,
            exports: [alicloud_service_1.AlicloudService],
        };
    }
};
exports.AlicloudModule = AlicloudModule;
exports.AlicloudModule = AlicloudModule = AlicloudModule_1 = __decorate([
    (0, common_1.Global)()
], AlicloudModule);


/***/ }),
/* 7 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AlicloudService = void 0;
const common_1 = __webpack_require__(3);
const iot20180120_1 = __webpack_require__(8), $Iot = iot20180120_1;
const $OpenApi = __webpack_require__(9);
const IotCofig_1 = __webpack_require__(10);
const node_crypto_1 = __webpack_require__(11);
let AlicloudService = class AlicloudService {
    constructor(options) {
        this.options = options;
        this.iotClient();
    }
    iotClient() {
        let config = new $OpenApi.Config({
            accessKeyId: this.options.accessKeyId,
            accessKeySecret: this.options.accessKeySecret,
            regionId: this.options.regionId
        });
        this.client = new iot20180120_1.default(config);
    }
    async registerDevice(productKey, deviceName) {
        try {
            const req = new $Iot.RegisterDeviceRequest({
                productKey,
                deviceName: deviceName,
            });
            if (this.options.iotInstanceId) {
                req.iotInstanceId = this.options.iotInstanceId;
            }
            const r = await this.client.registerDevice(req);
            if (r.statusCode == 200)
                return r.body;
        }
        catch (error) {
        }
        return null;
    }
    async queryDeviceInfo(productKey, deviceName) {
        try {
            const req = new $Iot.QueryDeviceInfoRequest({
                productKey,
                deviceName: deviceName,
            });
            if (this.options.iotInstanceId) {
                req.iotInstanceId = this.options.iotInstanceId;
            }
            const r = await this.client.queryDeviceInfo(req);
            if (r.statusCode == 200)
                return r.body;
        }
        catch (error) {
        }
        return null;
    }
    async batchQueryDeviceDetail(productKey, deviceNames) {
        try {
            const req = new $Iot.BatchQueryDeviceDetailRequest({
                deviceName: deviceNames,
                productKey: productKey,
            });
            if (this.options.iotInstanceId) {
                req.iotInstanceId = this.options.iotInstanceId;
            }
            const r = await this.client.batchQueryDeviceDetail(req);
            if (r.statusCode == 200)
                return r.body;
        }
        catch (error) {
        }
        return null;
    }
    async batchCheckDeviceNames(productKey, deviceNames) {
        try {
            const req = new $Iot.BatchCheckDeviceNamesRequest({
                productKey,
                deviceName: deviceNames,
            });
            if (this.options.iotInstanceId) {
                req.iotInstanceId = this.options.iotInstanceId;
            }
            const r = await this.client.batchCheckDeviceNames(req);
            if (r.statusCode == 200)
                return r.body;
        }
        catch (error) {
        }
        return null;
    }
    async batchRegisterDeviceWithApplyId(productKey, applyId) {
        try {
            const req = new $Iot.BatchRegisterDeviceWithApplyIdRequest({
                productKey,
                applyId: applyId,
            });
            if (this.options.iotInstanceId) {
                req.iotInstanceId = this.options.iotInstanceId;
            }
            const r = await this.client.batchRegisterDeviceWithApplyId(req);
            if (r.statusCode == 200)
                return r.body;
        }
        catch (error) {
        }
        return null;
    }
    async deleteDevice(productKey, deviceName) {
        try {
            const req = new $Iot.DeleteDeviceRequest({
                productKey: productKey,
                deviceName: deviceName
            });
            if (this.options.iotInstanceId) {
                req.iotInstanceId = this.options.iotInstanceId;
            }
            const r = await this.client.deleteDevice(req);
            if (r.statusCode == 200)
                return r.body;
        }
        catch (error) {
        }
        return null;
    }
    async batchPub(productKey, topicTemplateName, deviceNames, messageContent, options = {}) {
        try {
            const req = new $Iot.BatchPubRequest({
                productKey: productKey,
                deviceName: deviceNames,
                topicTemplateName: topicTemplateName,
                messageContent: Buffer.from(JSON.stringify(messageContent)).toString('base64'),
                ...options
            });
            if (this.options.iotInstanceId) {
                req.iotInstanceId = this.options.iotInstanceId;
            }
            const r = await this.client.batchPub(req);
            if (r.statusCode == 200)
                return r.body;
        }
        catch (error) {
        }
        return null;
    }
    async pub(productKey, topicFullName, deviceName, messageContent, options = {}) {
        try {
            console.log(messageContent);
            if (!messageContent.msgId) {
                messageContent.msgId = (0, node_crypto_1.createHash)('md5').update(Date.now() + deviceName).digest('hex').toLowerCase().substring(0, 16);
            }
            else {
                if (messageContent.msgId.length < 16) {
                    messageContent.msgId = messageContent.msgId.padStart(16, '0');
                }
            }
            const req = new $Iot.PubRequest({
                productKey: productKey,
                deviceName: deviceName,
                topicFullName: topicFullName,
                messageContent: Buffer.from(JSON.stringify(messageContent)).toString('base64'),
                ...options
            });
            if (this.options.iotInstanceId) {
                req.iotInstanceId = this.options.iotInstanceId;
            }
            const r = await this.client.pub(req);
            if (r.statusCode == 200)
                return r.body;
        }
        catch (error) {
        }
        return null;
    }
};
exports.AlicloudService = AlicloudService;
exports.AlicloudService = AlicloudService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, common_1.Inject)('ALI_MODULE_OPTIONS')),
    __metadata("design:paramtypes", [typeof (_a = typeof IotCofig_1.IotConfig !== "undefined" && IotCofig_1.IotConfig) === "function" ? _a : Object])
], AlicloudService);


/***/ }),
/* 8 */
/***/ ((module) => {

module.exports = require("@alicloud/iot20180120");

/***/ }),
/* 9 */
/***/ ((module) => {

module.exports = require("@alicloud/openapi-client");

/***/ }),
/* 10 */
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));


/***/ }),
/* 11 */
/***/ ((module) => {

module.exports = require("node:crypto");

/***/ }),
/* 12 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
__exportStar(__webpack_require__(13), exports);
__exportStar(__webpack_require__(15), exports);


/***/ }),
/* 13 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CacheModule = void 0;
const common_1 = __webpack_require__(3);
const cache_manager_1 = __webpack_require__(14);
const cache_service_1 = __webpack_require__(15);
const configure_1 = __webpack_require__(17);
const cache_manager_ioredis_yet_1 = __webpack_require__(25);
let CacheModule = class CacheModule {
};
exports.CacheModule = CacheModule;
exports.CacheModule = CacheModule = __decorate([
    (0, common_1.Global)(),
    (0, common_1.Module)({
        imports: [cache_manager_1.CacheModule.registerAsync({
                imports: [configure_1.ConfigureModule],
                inject: [configure_1.ConfigureService],
                useFactory: (config) => {
                    return {
                        store: cache_manager_ioredis_yet_1.redisStore,
                        ...config.get('cache')
                    };
                }
            })],
        providers: [cache_service_1.CacheService],
        exports: [cache_service_1.CacheService],
    })
], CacheModule);


/***/ }),
/* 14 */
/***/ ((module) => {

module.exports = require("@nestjs/cache-manager");

/***/ }),
/* 15 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CacheService = void 0;
const cache_manager_1 = __webpack_require__(14);
const common_1 = __webpack_require__(3);
const cache_manager_2 = __webpack_require__(16);
let CacheService = class CacheService {
    constructor(cacheManager) {
        this.cacheManager = cacheManager;
        this.Client = this.cacheManager.store.client;
    }
    get client() {
        return this.Client;
    }
    async set(...args) {
        let res;
        let argsLen = args.length;
        if (argsLen == 2) {
            res = await this.Client.set(args[0], args[1]);
        }
        else if (argsLen == 3) {
            res = await this.Client.set(args[0], args[1], 'EX', args[2]);
        }
        else if (argsLen == 4) {
            res = await this.Client.set(args[0], args[1], 'EX', args[2], 'NX');
        }
        return res === 'OK';
    }
    pop(key) {
        return this.Client.rpop(key);
    }
    get(key) {
        return this.Client.get(key);
    }
    del(...keys) {
        return this.Client.del(...keys);
    }
    blpop(key, timeout) {
        return this.Client.blpop(key, timeout);
    }
    async blockLock(key, timeout) {
        const len = await this.Client.llen(key);
        if (len == 0) {
            const rs = await this.set(key + ':nx', '1', timeout + 3, 'NX');
            if (rs) {
                return true;
            }
        }
        const res = await this.blpop(key, timeout);
        return res ? true : false;
    }
    async unBlockLock(key) {
        this.Client.lpush(key, '1');
    }
    hmset(key, data) {
        this.Client.hmset(key, data);
    }
    hgetall(key) {
        return this.Client.hgetall(key);
    }
};
exports.CacheService = CacheService;
exports.CacheService = CacheService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, common_1.Inject)(cache_manager_1.CACHE_MANAGER)),
    __metadata("design:paramtypes", [typeof (_a = typeof cache_manager_2.Cache !== "undefined" && cache_manager_2.Cache) === "function" ? _a : Object])
], CacheService);


/***/ }),
/* 16 */
/***/ ((module) => {

module.exports = require("cache-manager");

/***/ }),
/* 17 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
__exportStar(__webpack_require__(18), exports);
__exportStar(__webpack_require__(19), exports);


/***/ }),
/* 18 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var ConfigureModule_1;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ConfigureModule = void 0;
const common_1 = __webpack_require__(3);
const configure_service_1 = __webpack_require__(19);
const config_1 = __webpack_require__(20);
const config_2 = __webpack_require__(21);
const fs = __webpack_require__(22);
const path = __webpack_require__(23);
const yaml = __webpack_require__(24);
let ConfigureModule = ConfigureModule_1 = class ConfigureModule {
    static async forRoot(load = null) {
        const loads = [config_2.default];
        if (load) {
            loads.push(load);
        }
        try {
            const folderPath = 'config';
            const files = await fs.promises.readdir(folderPath);
            for (const file of files) {
                const filePath = path.join(folderPath, file);
                loads.push(() => {
                    return yaml.load(fs.readFileSync(filePath, 'utf8'));
                });
            }
        }
        catch (err) {
            console.error(err);
        }
        const options = {
            isGlobal: true,
            expandVariables: true,
            load: loads,
            envFilePath: [`.env.${process.env.APP_NAME}`, '.env', `.env.${process.env.NODE_ENV}`]
        };
        return {
            global: true,
            module: ConfigureModule_1,
            providers: [configure_service_1.ConfigureService],
            exports: [configure_service_1.ConfigureService],
            imports: [
                config_1.ConfigModule.forRoot(options)
            ]
        };
    }
};
exports.ConfigureModule = ConfigureModule;
exports.ConfigureModule = ConfigureModule = ConfigureModule_1 = __decorate([
    (0, common_1.Global)()
], ConfigureModule);


/***/ }),
/* 19 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ConfigureService = void 0;
const common_1 = __webpack_require__(3);
const config_1 = __webpack_require__(20);
let ConfigureService = class ConfigureService {
    constructor(configService) {
        this.configService = configService;
    }
    get(propertyPath) {
        return this.configService.get(propertyPath);
    }
};
exports.ConfigureService = ConfigureService;
exports.ConfigureService = ConfigureService = __decorate([
    (0, common_1.Injectable)(),
    __metadata("design:paramtypes", [typeof (_a = typeof config_1.ConfigService !== "undefined" && config_1.ConfigService) === "function" ? _a : Object])
], ConfigureService);


/***/ }),
/* 20 */
/***/ ((module) => {

module.exports = require("@nestjs/config");

/***/ }),
/* 21 */
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports["default"] = () => {
    return {
        wxAccessTokenKey: 'wx:access:token',
        startChargeResKey: 'scr:',
        endChargeResKey: 'ecr:',
        userChargingOrderKey: 'ucing:',
        devicePortChargingKeyReg: 'd:?:p:?',
        deviceIdPortToOrderIdReg: '?:?:oid',
        PstartChargeResKey: 'p:scr:',
        PendChargeResKey: 'p:ecr:',
        PdeviceChargingOrderKey: 'p:dcing:',
        aliToDeviceTopicReg: '/?/?/user/alternating/get',
        deviceMsgListKeys: {
            chargeInfo: 'charge:info:list'
        }
    };
};


/***/ }),
/* 22 */
/***/ ((module) => {

module.exports = require("fs");

/***/ }),
/* 23 */
/***/ ((module) => {

module.exports = require("path");

/***/ }),
/* 24 */
/***/ ((module) => {

module.exports = require("js-yaml");

/***/ }),
/* 25 */
/***/ ((module) => {

module.exports = require("cache-manager-ioredis-yet");

/***/ }),
/* 26 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CleanRecordRepositoryService = void 0;
const common_1 = __webpack_require__(3);
const typeorm_1 = __webpack_require__(27);
const typeorm_2 = __webpack_require__(28);
const base_service_1 = __webpack_require__(29);
const CleanRecord_1 = __webpack_require__(30);
let CleanRecordRepositoryService = class CleanRecordRepositoryService extends base_service_1.BaseService {
    constructor(repository) {
        super();
        this.repository = repository;
        this.primaryKey = 'id';
    }
};
exports.CleanRecordRepositoryService = CleanRecordRepositoryService;
exports.CleanRecordRepositoryService = CleanRecordRepositoryService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(CleanRecord_1.CleanRecord)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], CleanRecordRepositoryService);


/***/ }),
/* 27 */
/***/ ((module) => {

module.exports = require("@nestjs/typeorm");

/***/ }),
/* 28 */
/***/ ((module) => {

module.exports = require("typeorm");

/***/ }),
/* 29 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.BaseService = void 0;
const common_1 = __webpack_require__(3);
let BaseService = class BaseService {
    getRepository() {
        return this.repository;
    }
    get aliasToOriginalFields() {
        if (!this.aliasToOriginalFieldsMap) {
            this.aliasToOriginalFieldsMap = {};
            this.repository.metadata.ownColumns.forEach(column => {
                this.aliasToOriginalFieldsMap[column.propertyName] = column.databaseName;
            });
        }
        return this.aliasToOriginalFieldsMap;
    }
    get metadata() {
        return this.repository.metadata;
    }
    get tableName() {
        return this.repository.metadata.tableName;
    }
    createQueryBuilder() {
        return this.repository.createQueryBuilder();
    }
    aliasToFields(fields) {
        const aliasToOriginalFieldsMap = this.aliasToOriginalFields;
        return fields.map((field) => `\`${aliasToOriginalFieldsMap[field]}\` as \`${field}\``).join(',');
    }
    createQueryRunner() {
        return this.dataSource.createQueryRunner();
    }
    query(query, parameters) {
        return this.repository.query(query, parameters);
    }
    async count(where) {
        let total = await this.repository.count({
            where: where
        });
        return total;
    }
    async pagination(pageNo, pageSize, where, select, order) {
        pageSize = Number(pageSize);
        return this.find(where, select, (Number(pageNo) - 1) * pageSize, pageSize, order);
    }
    findOne(where, select, order) {
        return this.repository.findOne({
            select: select,
            where: where,
            order: order
        });
    }
    find(where, select, skip, take, order) {
        let options = {};
        if (where) {
            options.where = where;
        }
        if (select) {
            options.select = select;
        }
        if (skip) {
            options.skip = skip;
        }
        if (take) {
            options.take = take;
        }
        if (order) {
            options.order = order;
        }
        return this.repository.find(options);
    }
    async value(where, field) {
        const res = await this.findOne(where, [field]);
        return res ? res[field] : undefined;
    }
    async isExistsByWhere(where) {
        let res = await this.findOne(where, [this.primaryKey]);
        return res ? true : false;
    }
    async save(data, options) {
        return this.repository.save(data, options);
    }
    async saveMany(data, options) {
        return this.repository.save(data, options);
    }
    async insert(data) {
        let result = null;
        try {
            let res = await this.repository.insert(data);
            if (res) {
                let generatedMaps = res.generatedMaps;
                if (generatedMaps && generatedMaps.length > 0) {
                    result = {
                        affectedRows: generatedMaps.length,
                        rows: generatedMaps
                    };
                }
            }
        }
        catch (error) {
            console.log(error);
        }
        return result;
    }
    async update(criteria, partialEntity) {
        try {
            let res = await this.repository.update(criteria, partialEntity);
            return res.affected;
        }
        catch (error) {
            console.log(error);
        }
        return 0;
    }
    async delete(criteria) {
        try {
            let res = await this.repository.delete(criteria);
            return res.affected;
        }
        catch (error) {
        }
        return 0;
    }
};
exports.BaseService = BaseService;
exports.BaseService = BaseService = __decorate([
    (0, common_1.Injectable)()
], BaseService);


/***/ }),
/* 30 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CleanRecord = void 0;
const typeorm_1 = __webpack_require__(28);
let CleanRecord = class CleanRecord {
};
exports.CleanRecord = CleanRecord;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", name: "id", unsigned: true }),
    __metadata("design:type", Number)
], CleanRecord.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "user_id", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], CleanRecord.prototype, "userId", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "device_id", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], CleanRecord.prototype, "deviceId", void 0);
__decorate([
    (0, typeorm_1.Column)("tinyint", {
        name: "status",
        comment: "0：等待开启，1：检测中，2：检测失败",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], CleanRecord.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)("tinyint", {
        name: "err",
        comment: "",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], CleanRecord.prototype, "err", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "create_time",
        comment: "创建时间",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], CleanRecord.prototype, "createTime", void 0);
exports.CleanRecord = CleanRecord = __decorate([
    (0, typeorm_1.Index)("device_id", ["deviceId"], {}),
    (0, typeorm_1.Index)("user_id", ["userId"], {}),
    (0, typeorm_1.Entity)("clean_record", { schema: "bacsense_water" })
], CleanRecord);


/***/ }),
/* 31 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DeviceRepositoryService = void 0;
const common_1 = __webpack_require__(3);
const typeorm_1 = __webpack_require__(27);
const typeorm_2 = __webpack_require__(28);
const base_service_1 = __webpack_require__(29);
const Device_1 = __webpack_require__(32);
let DeviceRepositoryService = class DeviceRepositoryService extends base_service_1.BaseService {
    constructor(repository) {
        super();
        this.repository = repository;
        this.primaryKey = 'id';
    }
};
exports.DeviceRepositoryService = DeviceRepositoryService;
exports.DeviceRepositoryService = DeviceRepositoryService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(Device_1.Device)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], DeviceRepositoryService);


/***/ }),
/* 32 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Device = void 0;
const typeorm_1 = __webpack_require__(28);
let Device = class Device {
};
exports.Device = Device;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", name: "id", unsigned: true }),
    __metadata("design:type", Number)
], Device.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)("varchar", { name: "name", length: 100 }),
    __metadata("design:type", String)
], Device.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "device_type_id",
        comment: "类型",
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], Device.prototype, "deviceTypeId", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "total_water_usage",
        comment: "总用水量",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], Device.prototype, "totalWaterUsage", void 0);
__decorate([
    (0, typeorm_1.Column)("json", { name: "port_data", nullable: true, comment: "端口数据" }),
    __metadata("design:type", Object)
], Device.prototype, "portData", void 0);
__decorate([
    (0, typeorm_1.Column)("tinyint", {
        name: "connect_status",
        comment: "链接状态1：是，0：否",
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], Device.prototype, "connectStatus", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "online_time",
        comment: "上线时间",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], Device.prototype, "onlineTime", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "offline_time",
        comment: "离线时间",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], Device.prototype, "offlineTime", void 0);
__decorate([
    (0, typeorm_1.Column)("boolean", {
        name: "at_ali",
        comment: "是否已经注册到阿里云"
    }),
    __metadata("design:type", Boolean)
], Device.prototype, "atAli", void 0);
__decorate([
    (0, typeorm_1.Column)("char", { name: "ali_id", comment: "阿里云的设备id", length: 32 }),
    __metadata("design:type", String)
], Device.prototype, "aliId", void 0);
__decorate([
    (0, typeorm_1.Column)("char", {
        name: "ali_secret",
        comment: "阿里云的设备Secret",
        length: 32,
    }),
    __metadata("design:type", String)
], Device.prototype, "aliSecret", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "merchant_id", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], Device.prototype, "merchantId", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "station_id",
        comment: "站点id",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], Device.prototype, "stationId", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "user_id", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], Device.prototype, "userId", void 0);
__decorate([
    (0, typeorm_1.Column)("char", { name: "sim", comment: "物联网卡", length: 20 }),
    __metadata("design:type", String)
], Device.prototype, "sim", void 0);
__decorate([
    (0, typeorm_1.Column)("varchar", { name: "hardware", comment: "硬件", length: 30 }),
    __metadata("design:type", String)
], Device.prototype, "hardware", void 0);
__decorate([
    (0, typeorm_1.Column)("varchar", { name: "software", comment: "软件", length: 30 }),
    __metadata("design:type", String)
], Device.prototype, "software", void 0);
__decorate([
    (0, typeorm_1.Column)("tinyint", {
        name: "signal",
        comment: "信号强度",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], Device.prototype, "signal", void 0);
__decorate([
    (0, typeorm_1.Column)("varchar", { name: "remark", length: 100 }),
    __metadata("design:type", String)
], Device.prototype, "remark", void 0);
__decorate([
    (0, typeorm_1.Column)("boolean", {
        name: "is_private",
        comment: "1：私人的"
    }),
    __metadata("design:type", Boolean)
], Device.prototype, "isPrivate", void 0);
__decorate([
    (0, typeorm_1.Column)("boolean", { name: "enable" }),
    __metadata("design:type", Boolean)
], Device.prototype, "enable", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "creator_id",
        comment: "创建人",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], Device.prototype, "creatorId", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "create_time", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], Device.prototype, "createTime", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "update_time", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], Device.prototype, "updateTime", void 0);
exports.Device = Device = __decorate([
    (0, typeorm_1.Entity)("device", { schema: "charge" })
], Device);


/***/ }),
/* 33 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.User = void 0;
const typeorm_1 = __webpack_require__(28);
let User = class User {
};
exports.User = User;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", name: "id", unsigned: true }),
    __metadata("design:type", Number)
], User.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)("varchar", { name: "openid", unique: true, length: 32 }),
    __metadata("design:type", String)
], User.prototype, "openid", void 0);
__decorate([
    (0, typeorm_1.Column)("varchar", { name: "unionid", length: 32 }),
    __metadata("design:type", String)
], User.prototype, "unionid", void 0);
__decorate([
    (0, typeorm_1.Column)("varchar", { name: "nickname", length: 50 }),
    __metadata("design:type", String)
], User.prototype, "nickname", void 0);
__decorate([
    (0, typeorm_1.Column)("varchar", { name: "avatar", length: 100 }),
    __metadata("design:type", String)
], User.prototype, "avatar", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "inviter",
        comment: "邀请人",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], User.prototype, "inviter", void 0);
__decorate([
    (0, typeorm_1.Column)("char", { name: "phone", nullable: true, length: 11 }),
    __metadata("design:type", String)
], User.prototype, "phone", void 0);
__decorate([
    (0, typeorm_1.Column)("tinyint", { name: "source", default: () => "'0'" }),
    __metadata("design:type", Number)
], User.prototype, "source", void 0);
__decorate([
    (0, typeorm_1.Column)("tinyint", {
        name: "payscore",
        comment: "是否开启支付分0,1",
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], User.prototype, "payscore", void 0);
__decorate([
    (0, typeorm_1.Column)("decimal", {
        name: "amount",
        precision: 6,
        scale: 2,
        default: () => "'0.00'",
        transformer: {
            to(value) {
                return String(value || 0);
            },
            from(value) {
                return Number(value || 0);
            }
        }
    }),
    __metadata("design:type", Number)
], User.prototype, "amount", void 0);
__decorate([
    (0, typeorm_1.Column)("decimal", {
        name: "reward_amount",
        precision: 6,
        scale: 2,
        default: () => "'0.00'",
        transformer: {
            to(value) {
                return String(value || 0);
            },
            from(value) {
                return Number(value || 0);
            }
        }
    }),
    __metadata("design:type", Number)
], User.prototype, "rewardAmount", void 0);
__decorate([
    (0, typeorm_1.Column)("decimal", {
        name: "freeze_amount",
        precision: 6,
        scale: 2,
        default: () => "'0.00'",
        transformer: {
            to(value) {
                return String(value || 0);
            },
            from(value) {
                return Number(value || 0);
            }
        }
    }),
    __metadata("design:type", Number)
], User.prototype, "freezeAmount", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "register_time",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], User.prototype, "registerTime", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "last_login_time",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], User.prototype, "lastLoginTime", void 0);
exports.User = User = __decorate([
    (0, typeorm_1.Index)("openid", ["openid"], { unique: true }),
    (0, typeorm_1.Entity)("user", { schema: "bacsense_water" })
], User);


/***/ }),
/* 34 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UserWalletLog = void 0;
const typeorm_1 = __webpack_require__(28);
let UserWalletLog = class UserWalletLog {
};
exports.UserWalletLog = UserWalletLog;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", name: "id", unsigned: true }),
    __metadata("design:type", Number)
], UserWalletLog.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "user_id", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], UserWalletLog.prototype, "userId", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "relation_id", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], UserWalletLog.prototype, "relationId", void 0);
__decorate([
    (0, typeorm_1.Column)("decimal", {
        name: "amount",
        precision: 6,
        scale: 2,
        default: () => "'0.00'",
    }),
    __metadata("design:type", String)
], UserWalletLog.prototype, "amount", void 0);
__decorate([
    (0, typeorm_1.Column)("decimal", {
        name: "reward_amount",
        precision: 6,
        scale: 2,
        default: () => "'0.00'",
    }),
    __metadata("design:type", String)
], UserWalletLog.prototype, "rewardAmount", void 0);
__decorate([
    (0, typeorm_1.Column)("decimal", {
        name: "before_amount",
        precision: 6,
        scale: 2,
        default: () => "'0.00'",
    }),
    __metadata("design:type", String)
], UserWalletLog.prototype, "beforeAmount", void 0);
__decorate([
    (0, typeorm_1.Column)("decimal", {
        name: "before_reward_amount",
        precision: 6,
        scale: 2,
        default: () => "'0.00'",
    }),
    __metadata("design:type", String)
], UserWalletLog.prototype, "beforeRewardAmount", void 0);
__decorate([
    (0, typeorm_1.Column)("decimal", {
        name: "after_amount",
        precision: 6,
        scale: 2,
        default: () => "'0.00'",
    }),
    __metadata("design:type", String)
], UserWalletLog.prototype, "afterAmount", void 0);
__decorate([
    (0, typeorm_1.Column)("decimal", {
        name: "after_reward_amount",
        precision: 6,
        scale: 2,
        default: () => "'0.00'",
    }),
    __metadata("design:type", String)
], UserWalletLog.prototype, "afterRewardAmount", void 0);
__decorate([
    (0, typeorm_1.Column)("tinyint", {
        name: "type",
        comment: "1,充值，2，水费扣费",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], UserWalletLog.prototype, "type", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "create_time",
        comment: "创建时间",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], UserWalletLog.prototype, "createTime", void 0);
exports.UserWalletLog = UserWalletLog = __decorate([
    (0, typeorm_1.Index)("user_id", ["userId"], {}),
    (0, typeorm_1.Entity)("user_wallet_log", { schema: "bacsense_water" })
], UserWalletLog);


/***/ }),
/* 35 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WaterBills = void 0;
const typeorm_1 = __webpack_require__(28);
let WaterBills = class WaterBills {
};
exports.WaterBills = WaterBills;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", name: "id", unsigned: true }),
    __metadata("design:type", Number)
], WaterBills.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "user_id", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], WaterBills.prototype, "userId", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "device_id", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], WaterBills.prototype, "deviceId", void 0);
__decorate([
    (0, typeorm_1.Column)("decimal", {
        name: "amount",
        precision: 6,
        scale: 2,
        default: () => "'0.00'",
    }),
    __metadata("design:type", String)
], WaterBills.prototype, "amount", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "water_usage", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], WaterBills.prototype, "waterUsage", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "tds_raw", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], WaterBills.prototype, "tdsRaw", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "tds_clean", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], WaterBills.prototype, "tdsClean", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "report_time",
        comment: "上报时间",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], WaterBills.prototype, "reportTime", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "create_time",
        comment: "创建时间",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], WaterBills.prototype, "createTime", void 0);
exports.WaterBills = WaterBills = __decorate([
    (0, typeorm_1.Index)("device_id", ["deviceId"], {}),
    (0, typeorm_1.Entity)("water_bills", { schema: "bacsense_water" })
], WaterBills);


/***/ }),
/* 36 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UserRepositoryService = void 0;
const common_1 = __webpack_require__(3);
const base_service_1 = __webpack_require__(29);
const User_1 = __webpack_require__(33);
const typeorm_1 = __webpack_require__(27);
const typeorm_2 = __webpack_require__(28);
let UserRepositoryService = class UserRepositoryService extends base_service_1.BaseService {
    constructor(repository) {
        super();
        this.repository = repository;
        this.primaryKey = 'id';
    }
};
exports.UserRepositoryService = UserRepositoryService;
exports.UserRepositoryService = UserRepositoryService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(User_1.User)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], UserRepositoryService);


/***/ }),
/* 37 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WaterTestRepositoryService = void 0;
const common_1 = __webpack_require__(3);
const typeorm_1 = __webpack_require__(27);
const typeorm_2 = __webpack_require__(28);
const base_service_1 = __webpack_require__(29);
const WaterTest_1 = __webpack_require__(38);
let WaterTestRepositoryService = class WaterTestRepositoryService extends base_service_1.BaseService {
    constructor(repository) {
        super();
        this.repository = repository;
        this.primaryKey = 'id';
    }
};
exports.WaterTestRepositoryService = WaterTestRepositoryService;
exports.WaterTestRepositoryService = WaterTestRepositoryService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(WaterTest_1.WaterTest)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], WaterTestRepositoryService);


/***/ }),
/* 38 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WaterTest = void 0;
const typeorm_1 = __webpack_require__(28);
let WaterTest = class WaterTest {
};
exports.WaterTest = WaterTest;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", name: "id", unsigned: true }),
    __metadata("design:type", Number)
], WaterTest.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "user_id", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], WaterTest.prototype, "userId", void 0);
__decorate([
    (0, typeorm_1.Column)("int", { name: "device_id", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], WaterTest.prototype, "deviceId", void 0);
__decorate([
    (0, typeorm_1.Column)("tinyint", {
        name: "status",
        comment: "0：等待开启，1：检测中，2：检测失败，3，结束检测，4：检测停止",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], WaterTest.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.Column)("smallint", { name: "result", unsigned: true, default: () => "'0'" }),
    __metadata("design:type", Number)
], WaterTest.prototype, "result", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "create_time",
        comment: "创建时间",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], WaterTest.prototype, "createTime", void 0);
__decorate([
    (0, typeorm_1.Column)("int", {
        name: "end_time",
        comment: "创建时间",
        unsigned: true,
        default: () => "'0'",
    }),
    __metadata("design:type", Number)
], WaterTest.prototype, "endTime", void 0);
exports.WaterTest = WaterTest = __decorate([
    (0, typeorm_1.Index)("device_id", ["deviceId"], {}),
    (0, typeorm_1.Entity)("water_test", { schema: "bacsense_water" })
], WaterTest);


/***/ }),
/* 39 */
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DEVICE_CTR_ORDER = void 0;
exports.DEVICE_CTR_ORDER = {
    SET_START_DEVICE: 'setStartStu',
    SET_CLEAN_DEVICE: 'setClearStu',
    SET_MAX_WATER_FLOW: 'setMaxWaterFlow',
    SET_CHECK_STEP: 'setCheckStep'
};


/***/ }),
/* 40 */
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DEVICE_CTR_RESULT = void 0;
exports.DEVICE_CTR_RESULT = {
    WAIT: 0,
    SUCCESS: 1,
    FAIL: 2
};


/***/ }),
/* 41 */
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TEST_STATUS = void 0;
exports.TEST_STATUS = {
    start: 0,
    testing: 1,
    fail: 2,
    stop: 3,
    end: 4
};


/***/ }),
/* 42 */
/***/ ((__unused_webpack_module, exports) => {


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WALLET_LOG_TYPE = void 0;
exports.WALLET_LOG_TYPE = {
    RECHARGE: 1,
    WATER_PAY: 2,
};


/***/ }),
/* 43 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WaterBillsRepositoryService = void 0;
const common_1 = __webpack_require__(3);
const typeorm_1 = __webpack_require__(27);
const typeorm_2 = __webpack_require__(28);
const base_service_1 = __webpack_require__(29);
const WaterBills_1 = __webpack_require__(35);
let WaterBillsRepositoryService = class WaterBillsRepositoryService extends base_service_1.BaseService {
    constructor(repository) {
        super();
        this.repository = repository;
        this.primaryKey = 'id';
    }
};
exports.WaterBillsRepositoryService = WaterBillsRepositoryService;
exports.WaterBillsRepositoryService = WaterBillsRepositoryService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(WaterBills_1.WaterBills)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], WaterBillsRepositoryService);


/***/ }),
/* 44 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UserRepositoryModule = void 0;
const common_1 = __webpack_require__(3);
const user_repository_service_1 = __webpack_require__(36);
const User_1 = __webpack_require__(33);
const typeorm_1 = __webpack_require__(27);
let UserRepositoryModule = class UserRepositoryModule {
};
exports.UserRepositoryModule = UserRepositoryModule;
exports.UserRepositoryModule = UserRepositoryModule = __decorate([
    (0, common_1.Module)({
        imports: [typeorm_1.TypeOrmModule.forFeature([User_1.User])],
        providers: [user_repository_service_1.UserRepositoryService],
        exports: [user_repository_service_1.UserRepositoryService]
    })
], UserRepositoryModule);


/***/ }),
/* 45 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DeviceRepositoryModule = void 0;
const common_1 = __webpack_require__(3);
const device_repository_service_1 = __webpack_require__(31);
const typeorm_1 = __webpack_require__(27);
const Device_1 = __webpack_require__(32);
let DeviceRepositoryModule = class DeviceRepositoryModule {
};
exports.DeviceRepositoryModule = DeviceRepositoryModule;
exports.DeviceRepositoryModule = DeviceRepositoryModule = __decorate([
    (0, common_1.Module)({
        imports: [typeorm_1.TypeOrmModule.forFeature([Device_1.Device])],
        providers: [device_repository_service_1.DeviceRepositoryService],
        exports: [device_repository_service_1.DeviceRepositoryService]
    })
], DeviceRepositoryModule);


/***/ }),
/* 46 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WaterTestRepositoryModule = void 0;
const common_1 = __webpack_require__(3);
const water_test_repository_service_1 = __webpack_require__(37);
const typeorm_1 = __webpack_require__(27);
const WaterTest_1 = __webpack_require__(38);
let WaterTestRepositoryModule = class WaterTestRepositoryModule {
};
exports.WaterTestRepositoryModule = WaterTestRepositoryModule;
exports.WaterTestRepositoryModule = WaterTestRepositoryModule = __decorate([
    (0, common_1.Module)({
        imports: [typeorm_1.TypeOrmModule.forFeature([WaterTest_1.WaterTest])],
        exports: [water_test_repository_service_1.WaterTestRepositoryService],
        providers: [water_test_repository_service_1.WaterTestRepositoryService]
    })
], WaterTestRepositoryModule);


/***/ }),
/* 47 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CleanRecordRepositoryModule = void 0;
const common_1 = __webpack_require__(3);
const clean_record_repository_service_1 = __webpack_require__(26);
const typeorm_1 = __webpack_require__(27);
const CleanRecord_1 = __webpack_require__(30);
let CleanRecordRepositoryModule = class CleanRecordRepositoryModule {
};
exports.CleanRecordRepositoryModule = CleanRecordRepositoryModule;
exports.CleanRecordRepositoryModule = CleanRecordRepositoryModule = __decorate([
    (0, common_1.Module)({
        imports: [typeorm_1.TypeOrmModule.forFeature([CleanRecord_1.CleanRecord])],
        providers: [clean_record_repository_service_1.CleanRecordRepositoryService],
        exports: [clean_record_repository_service_1.CleanRecordRepositoryService]
    })
], CleanRecordRepositoryModule);


/***/ }),
/* 48 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WaterBillsRepositoryModule = void 0;
const common_1 = __webpack_require__(3);
const water_bills_repository_service_1 = __webpack_require__(43);
const typeorm_1 = __webpack_require__(27);
const WaterBills_1 = __webpack_require__(35);
let WaterBillsRepositoryModule = class WaterBillsRepositoryModule {
};
exports.WaterBillsRepositoryModule = WaterBillsRepositoryModule;
exports.WaterBillsRepositoryModule = WaterBillsRepositoryModule = __decorate([
    (0, common_1.Module)({
        imports: [typeorm_1.TypeOrmModule.forFeature([WaterBills_1.WaterBills])],
        exports: [water_bills_repository_service_1.WaterBillsRepositoryService],
        providers: [water_bills_repository_service_1.WaterBillsRepositoryService]
    })
], WaterBillsRepositoryModule);


/***/ }),
/* 49 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UserWalletLogRepositoryModule = void 0;
const common_1 = __webpack_require__(3);
const user_wallet_log_repository_service_1 = __webpack_require__(50);
const typeorm_1 = __webpack_require__(27);
const UserWalletLog_1 = __webpack_require__(34);
let UserWalletLogRepositoryModule = class UserWalletLogRepositoryModule {
};
exports.UserWalletLogRepositoryModule = UserWalletLogRepositoryModule;
exports.UserWalletLogRepositoryModule = UserWalletLogRepositoryModule = __decorate([
    (0, common_1.Module)({
        imports: [typeorm_1.TypeOrmModule.forFeature([UserWalletLog_1.UserWalletLog])],
        exports: [user_wallet_log_repository_service_1.UserWalletLogRepositoryService],
        providers: [user_wallet_log_repository_service_1.UserWalletLogRepositoryService]
    })
], UserWalletLogRepositoryModule);


/***/ }),
/* 50 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var _a;
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.UserWalletLogRepositoryService = void 0;
const common_1 = __webpack_require__(3);
const typeorm_1 = __webpack_require__(27);
const typeorm_2 = __webpack_require__(28);
const base_service_1 = __webpack_require__(29);
const UserWalletLog_1 = __webpack_require__(34);
let UserWalletLogRepositoryService = class UserWalletLogRepositoryService extends base_service_1.BaseService {
    constructor(repository) {
        super();
        this.repository = repository;
        this.primaryKey = 'id';
    }
};
exports.UserWalletLogRepositoryService = UserWalletLogRepositoryService;
exports.UserWalletLogRepositoryService = UserWalletLogRepositoryService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(UserWalletLog_1.UserWalletLog)),
    __metadata("design:paramtypes", [typeof (_a = typeof typeorm_2.Repository !== "undefined" && typeorm_2.Repository) === "function" ? _a : Object])
], UserWalletLogRepositoryService);


/***/ })
/******/ 	]);
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
(() => {
var exports = __webpack_exports__;

Object.defineProperty(exports, "__esModule", ({ value: true }));
const core_1 = __webpack_require__(1);
const msg_handle_module_1 = __webpack_require__(2);
async function bootstrap() {
    await core_1.NestFactory.createApplicationContext(msg_handle_module_1.MsgHandleModule);
    console.log(`------------ ${process.env.APP_NAME} start---------------`);
    const date = new Date();
    console.log(date.toLocaleDateString() + ' ' + date.toLocaleTimeString());
}
bootstrap();

})();

/******/ })()
;